package com.example.rabbitmqtest;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@Slf4j
@SpringBootApplication
public class RabbitmqTestApplication implements CommandLineRunner {
    @Autowired
    private Producer producer;

    public static void main(String[] args) {
        SpringApplication.run(RabbitmqTestApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        log.info("队列名称: {}", RabbitMQConfig.queueName);
        producer.sendDirectMsg(RabbitMQConfig.queueName, String.valueOf(System.currentTimeMillis()));
    }
}
